package projectg06;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import projectg06.hclinicas.ParserIn;
import static java.lang.System.out;
public class Runner {

	private static final String PROPERTIES_FILE_NAME="projectg06.properties";
	
	/**
	 * @param args
	 * @throws IOException 
	 */
		public static void main(String[] args) throws IOException {
			Properties p=null;
			String modulo=null;
			try{
				p=getProperties();
			}catch(FileNotFoundException fnf){
				out.println("Verificar la existencia del archivo:"+PROPERTIES_FILE_NAME+"en el directorio:"+System.getProperty("user.dir"));
			}
			
	        try{
	        	modulo = p.getProperty("modulo");
	        }catch(NullPointerException npe){
	        	out.print("No se pudo cargar las propiedades iniciales. Verificar el contenido del archivo: "+PROPERTIES_FILE_NAME);
	        }
	        
			if("generarinout".equalsIgnoreCase(modulo)){
				ParserIn parser=new ParserIn();
				parser.run(p);
			}else if("ordertables".equalsIgnoreCase(modulo)){
				out.println("nothing done");
			}else out.println("El modulo ["+modulo+"] no esta mapeado.");
			
		}

	private static Properties getProperties()throws IOException{
		Properties props = new Properties();
		props.load(new FileInputStream(".\\"+PROPERTIES_FILE_NAME));
		return props;
	}
		


}
